<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <!-- 省 -->
        <select name="" id="province" @change="addcity($event)">
            <option value="" selected disabled>请选择</option>
            <option v-for="(item,index) in getlist.prov">{{item.name}}</option>
        </select>
        <!-- 市 -->
        <select name="" id="city" @change="addarea($event)">
            <option value=" " selected disabled>请选择</option>
            <option v-for="(item,index) in getlist.city ">{{item.name}}</option>
        </select>
        <!-- 区 -->
        <select name=" " id="area ">
            <option value=" " selected disabled>请选择</option>
            <option v-for="(item,index) in getlist.area ">{{item}}</option>
        </select>
    </div>
    <script src="./js/index.js "></script>
    <script src="./js/vue.js "></script>
    <script>
        new Vue({
            el: '#app',
            data: {
                getlist: {
                    prov: data,
                    city: [],
                    area: []
                }
            },
            methods: {
                addcity(e) {
                    this.getlist.city = [];
                    this.getlist.prov.forEach((item) => {
                        if (item.name === e.target.value) {
                            item.city.forEach((item) => {
                                this.getlist.city.push(item)
                            })
                        }
                    })
                },
                addarea(e) {
                    this.getlist.area = [];
                    this.getlist.city.forEach((item) => {
                        if (item.name === e.target.value) {
                            item.area.forEach((item) => {
                                this.getlist.area.push(item)
                            })
                        }
                    })
                }
            },
        })
    </script>
</body>

</html>